<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HLD</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        img {
            width: 80px;
        }
        ul li{
            float: left;
            list-style: none;
        }
    </style>
</head>

<body>
    <ul id="img">
        <li><img src="images/1.jpg" alt=""></li>
        <li><img src="images/1.jpg" alt=""></li>
        <li><img src="images/1.jpg" alt=""></li>
        <li><img src="images/1.jpg" alt=""></li>
        <li><img src="images/1.jpg" alt=""></li>

    </ul>

    <script>
        var color = 1;
        var img = document.getElementById('img');
        img.innerHTML+=img.innerHTML;
        img.onclick = function (e) {
            color++;
            if (color > 3) {
                color = 1;
            }
            e.target.src = 'images/' + color + '.jpg';
        }
    </script>
</body>

</html>